cmake_minimum_required(VERSION 3.0.2)

set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "-std=c++17")
#add_definitions(-Wall -Werror)
# set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 
project(autoaim)
find_package(catkin REQUIRED COMPONENTS
  rm_interfaces
  roscpp
  sensor_msgs
  geometry_msgs
  cv_bridge_new
  message_filters
  dynamic_reconfigure
  tf2
  tf2_ros
  tf2_geometry_msgs
)
find_package(OpenCV REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(fmt REQUIRED)

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES detector
#  CATKIN_DEPENDS fyt_msg roscpp
#  DEPENDS system_lib
)

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
  ${EIGEN3_INCLUDE_DIRS}
)

set(DETECTOR_SRC
"detector/src/detector_node.cpp"
"detector/src/detector.cpp"
"detector/src/number_classifier.cpp"
"detector_main.cpp"
)
add_executable(detector_node ${DETECTOR_SRC})
add_dependencies(detector_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(detector_node configures_gencfg)
target_include_directories(detector_node PUBLIC
  ${CMAKE_CURRENT_SOURCE_DIR}/detector/include
  ${CMAKE_CURRENT_SOURCE_DIR}/myutils/include
)
target_link_libraries(detector_node
  ${catkin_LIBRARIES}
  ${OpenCV_LIBS}
  fmt::fmt
)

set(PROCESSOR_SRC
"post_processor/src/processor_node.cpp"
"post_processor/src/pnp_solver.cpp"
"post_processor/src/predictor.cpp"
"post_processor/src/tracker.cpp"
"post_processor/src/kalman_filter.cpp"
"processor_main.cpp"
)
add_executable(processor_node ${PROCESSOR_SRC})
add_dependencies(processor_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(processor_node configures_gencfg)
target_include_directories(processor_node PUBLIC
  ${CMAKE_CURRENT_SOURCE_DIR}/post_processor/include
  ${CMAKE_CURRENT_SOURCE_DIR}/myutils/include
)
target_link_libraries(processor_node
  ${catkin_LIBRARIES}
  ${OpenCV_LIBS}
  fmt::fmt
)
